﻿define('viewModels/edituser', ['data/users', 'logger', 'router', 'viewModel', 'data'], function (userData, log, router, viewModel, dataCore) {
    function view() {
        var self = this;

        function afterSave() {
            router.go('userList');
        }

        viewModel.addEditItemBehavior(self, 'new user', 'edit user', userData, userData.User, afterSave);
        self.activate = function (params, bind) {
            self.start(params, bind);
        };
        
        self.roles = function (initItem) {
            return dataCore.createLookup(userData.RolesLink, initItem);
        };
    }

    return new view();
});